<%@page import="org.springframework.security.core.context.SecurityContextHolder"%>
<%@page import="org.apache.commons.lang.StringUtils"%>
<%@page import="org.apache.commons.lang.time.DateFormatUtils"%>
<%@page import="org.springframework.util.CollectionUtils"%>
<%@page import="java.util.Collection"%>
<%@ include file="../common/common_include.jsp"%>
<%@ page language="java" contentType="text/html; charset=UTF-8"
	pageEncoding="UTF-8"%>

<%
	FaqForm form = (FaqForm)request.getAttribute("command");
	UserInfo user = (UserInfo)SecurityContextHolder.getContext().getAuthentication().getPrincipal();
	String userName = user.getName();
	String nowDate = DateFormatUtils.format(new Date(), "yyyy-MM-dd HH:mm:ss");
	String faqClass = request.getAttribute("faqClass")+"";
%>



		<div>

				<form id="faqFORM" name="form" target="coreIframe"
					action="<%=request.getContextPath()%>/faq/doAdd" method="post" enctype="multipart/form-data">
					<div class="breadcrumb">
						<div class="bcIcon"></div>
						<ul class="bcNav">

							<li>添加<%=faqClass %></li>
						</ul>


					</div>

					<table class="formTable">
<!-- 						<tr>
							<td class="tdTitle">FAQ类型:</td>
							<td>
								<select name="faqClass">
									<option value="常见问题">常见问题</option>
									<option value="服务指南">服务指南</option>
								</select>
							</td>
						</tr> -->
						<input type="hidden" name="faqClass" value="<%=faqClass%>">
						<tr>
							<td class="tdTitle">发布时间:</td>
							<td><input class="inputText xs" type="text"
								name="publicTime" checkNull="true" value="<%=nowDate%>"
								onClick="WdatePicker({dateFmt:'yyyy-MM-dd HH:mm:ss'})" /></td>
						</tr>
						<tr>
							<td class="tdTitle">发布人:</td>
							<td><input class="inputText xs" type="text" name="publicMan" checkNull="true" value="<%=userName%>" /></td>
						</tr>		
						<tr>
							<td class="tdTitle">问题:</td>
							<td><input class="inputText xs" type="text" name="faqQuestion" checkNull="true" placeholder="请输入标题" />
							<span class="errorTipWrap" id="errorTip_faqQuestion"></span>
							</td>
						</tr>
						<tr>
							<td class="tdTitle">答案：</td>
							<td class="" colspan="2">
								<div style="padding-top:10px;padding-bottom:10px;">
								<textarea id="content" name="faqAnswer" 
								style="width: 700px; height: 200px; visibility: hidden;"></textarea>
								</div>
								<span class="errorTipWrap" id="errorTip_faqAnswer"></span>
							</td>
						</tr>
						<tr>
							<td class="tdTitle"></td>
							<td>
								<div>
									<input class="input-btn-microsoft" type="submit" value="提交">
									<a class="a-btn-microsoft" href="javascript:XF.Faq.manageFaq()">取消</a>
								</div>
							</td>
						</tr>	
					</table>
				</form>
			</div>
	<iframe name="coreIframe" style="display: none"></iframe>

<script type="text/javascript">
<%-- 		var editor;
		KindEditor.ready(function(K) {
			editor = K.create('textarea[name="faqAnswer"]', {
				allowFileManager : true,
				uploadJson:'<%=request.getContextPath()%>/upload', 
				items : [
				 		'source', '|', 'undo', 'redo', '|', 'preview', 'print', 'template', 'code', 'cut', 'copy', 'paste',
				 		'plainpaste', 'wordpaste', '|', 'justifyleft', 'justifycenter', 'justifyright',
				 		'justifyfull', 'insertorderedlist', 'insertunorderedlist', 'indent', 'outdent', 'subscript',
				 		'superscript', 'clearhtml', 'quickformat', 'selectall', '|', 'fullscreen', '/',
				 		'formatblock', 'fontname', 'fontsize', '|', 'forecolor', 'hilitecolor', 'bold',
				 		'italic', 'underline', 'strikethrough', 'lineheight', 'removeformat', '|', 'image', 'multiimage',
				 		'flash', 'media','|', 'table', 'hr', 'emoticons', 'baidumap', 'pagebreak',
				 		'anchor', 'link', 'unlink'
				 	]
			});
		}); --%>
		
	$(function() {
		XF.createKindEditor("content");
		$("input[name=faqQuestion]").focus();
		//XF.Notice.init();
		//XF.Notice.init_css();
	});
</script>